<?php

    function swoole($data){
        
        $client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_SYNC);


        $client->connect('127.0.0.1', 9502) || exit("connect failed. Error: {$client->errCode}\n");

        $data = isset($data)?$data:'null';
        $client->send($data);

        $response = $client->recv();
        // 输出接受到的数据
        return $response . PHP_EOL; 
    }

   
